<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div style="margin:10px;">
	<div
		style="overflow:hidden;padding:0px;width:auto;min-height:0px;max-height:none;">
		<c:forEach var="category" items="${risk_category }">
			<li style="list-style-type:none;"><h3>${category.name }</h3><input id="${category.code }" vty="checkedSelected" vtv="${category.name }" style="display:none"/> <c:forEach
					var="entity" items="${risk_elementlist.content }">
					<c:choose>
						<c:when test="${category.code eq entity.categoryCode }">
							<div>
								<input type="radio" name="${category.name}"  id="${entity.id }" onclick="setSelected('${category.code }')"
									tval="${entity.influence }" /> <label for="${entity.id }" style="font-size:14px;">${entity.name}</span>
							</div>
						</c:when>
					</c:choose>
				</c:forEach></li>
		</c:forEach>
	</div>

</div>
<script type="text/javascript">
    function setSelected(n)
    {
      $("#"+n).val("selected");
    }
	function getSelectIds() {
	   var ifSuccess=true;
	   var errMsg="";
	   $("[vty='checkedSelected']").each(function()
	   {
	      var t1=$(this).val();
	      if(t1=="")
	      {
	        errMsg+="【"+$(this).attr("vtv")+"】必选选择一项！\n";
	        ifSuccess=false;
	        
	        //isperp.alert($(this).attr("vtv")+"必选选择一项！");
	      }
	   });
	   if(!ifSuccess)
	   {
	     alert(errMsg);
	     return false;
	   }
	
		var ids = "";
		var tvals = "";
		$('input:radio:checked').each(function() {
			ids += this.id + ",";
			tvals += $(this).attr("tval") + ",";
		});
		ids = ids.substring(0, ids.length - 1);
		tvals = tvals.substring(0, tvals.length - 1);
		var returnObj = {
			ids : ids,
			tvals : tvals
		};
	   return returnObj;
	}
</script>
